package com.iraeta.service.impl;

import com.iraeta.dao.DuanzaoDao;
import com.iraeta.entity.Duanzao;
import com.iraeta.service.DuanZaoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DuanZaoServiceImpl implements DuanZaoService {
    @Autowired
    DuanzaoDao duanzaoDao;

    @Override
    public void addDuanzao(Duanzao duanzao) {
        duanzaoDao.insert(duanzao);
    }

    @Override
    public void updateDuanzao(Duanzao duanzao) {
        duanzaoDao.updateByPrimaryKey(duanzao);
    }

    @Override
    public void deleteDuanzao(Integer id) {
        duanzaoDao.deleteByPrimaryKey(id);
    }

    @Override
    public Duanzao getDuanzao(Integer id) {
        return duanzaoDao.selectByPrimaryKey(id);
    }

    @Override
    public List<Duanzao> listAllDuanzao() {
        return duanzaoDao.selectAll();
    }

    @Override
    public List<Duanzao> listDuanzao(String name) {
        return duanzaoDao.selectByName(name);
    }
}
